package reflect;

import java.lang.reflect.Method;

public class ReflectDemo8 {
    public static void main(String[] args) throws Exception {
        Person person = new Person();
        Class c=Class.forName("reflect.Person");
        Object o = c.newInstance();
        Object o2=c.newInstance();
        Method method = c.getDeclaredMethod("hehe");
        method.setAccessible(true);
        method.invoke(o);
        //person.hehe();
        method.invoke(o2);
        method.setAccessible(false);
    }
}
